package com.dd.cloud.common.annotate.validation;

import com.dd.cloud.common.annotate.validation.impl.NameValidation;
import com.dd.cloud.common.constants.RegularConstants;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 验证姓名、昵称、管理员姓名、负责人、医生姓名、药房人员姓名、持卡人、药剂师职称，药材名称，
 * 角色名称，药材别名、药材规格、产地、供应商
 *
 * @author zk
 */
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = NameValidation.class)
public @interface Name {

    /**
     * 提示的开头 即替换message {begin}的内容
     * @return
     */
    String begin() default "";

    boolean required() default true;

    String message() default "{begin}内容格式为不超过"+ RegularConstants.Verify.MAX_NAME +"位的任何类型字符";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
